﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows;

namespace TableTopWidgets
{
    public class BorderMenu : ContentControl
    {
        public BorderMenu()
            : base()
        {
            DefaultStyleKey = typeof(BorderMenu);
            InitalizeCommands();
        }



        private static void InitalizeCommands()
        {
            BorderClickEvent = EventManager.RegisterRoutedEvent("BorderClick", RoutingStrategy.Bubble,
                             typeof(RoutedEventHandler), typeof(BorderMenu));
        }

        public static RoutedEvent BorderClickEvent;

        public event RoutedEventHandler BorderClick
        {
            add { AddHandler(BorderClickEvent, value); }
            remove { RemoveHandler(BorderClickEvent, value); }
        }

        protected virtual void OnBorderClick()
        {
            RoutedEventArgs args = new RoutedEventArgs();
            args.RoutedEvent = BorderClickEvent;
            RaiseEvent(args);
        }


        public static readonly DependencyProperty MainProperty =
            DependencyProperty.Register("Main", typeof(UIElement), typeof(BorderMenu), null);

        public UIElement Main
        {
            get
            {
                return (UIElement)GetValue(MainProperty);
            }
            set
            {
                SetValue(MainProperty, value);
            }
        }

        public static void OnBorderClicked(object sender, ExecutedRoutedEventArgs e)
        {
            BorderMenu bMenu = sender as BorderMenu;

            if (bMenu != null)
            {
                Console.Out.WriteLine("testing border click");
            }
        }

    }
}
